﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MvcApplication.CommonWebApi;
using Dapper;
using CommonWebApiTest.Domain;

namespace CommonWebApiTest
{
    [TestClass] 
    public class TestCommonAPi
    {
        [TestMethod]
        public void TestDapper()
        {
            var connection = ConnectionFactory.GetConnection(1);
            var text = ScriptCollection.GetCommandText("test_for_dapper");
            var results = connection.Query<NameValue>(text).AsList();
            Assert.IsTrue(results.Count == 1);

            var result = connection.QuerySingle<NameValue>(text);
            Assert.IsTrue(result.Name == "12");
            Assert.IsTrue(result.Value == 12);
        }
    }
}
